package sctu.edu.java.year2016.team01.xuhanmei.day20160619;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 * Created by Administrator on 2016/6/19.
 */
public class LearnWriter {
    public static void main(String[] args) {

        File dest = new File("d:/java小程序/LearnWriter.txt");

        Writer w = null;
        try {
            w = new FileWriter(dest,true);//追加
            String s = "锄禾日当午\r\n" +
                    "码农真辛苦\r\n" +
                    "一本小破书\r\n" +
                    "一坐一上午\r\n";
            w.write(s);

            w.append("我不要完美，只要能再回到原位。\n");
            w.flush();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (w != null) {
                try {
                    w.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }


    }
}
